<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<%-- @author: Christian Baumhof --%>

<%-- Title --%>
<h1>
	<s:text name="title.editExams" />
</h1>

<%-- Subject information --%>
<h2>
	<s:property value="selectedSubject.title" />
	-
	<s:property value="selectedSubject.description" />
</h2>

<%-- Maniple --%>
<table class="formTable">
	<tr>
		<td><s:text name="lbl.maniple" /></td>
		<td><s:property value="selectedManiple.name" /></td>
	</tr>
</table>

<%-- Data table--%>
<table>
	<%-- Column headlines --%>
	<tr>
		<th><s:text name="lbl.student" /></th>
		<th><s:text name="lbl.try1" /></th>
		<th><s:text name="lbl.try2" /></th>
		<th><s:text name="lbl.try3" /></th>
		<th><s:text name="lbl.examDate" /></th>
		<th><s:text name="lbl.lecturer" /></th>
		<th><s:text name="lbl.typist" /></th>
		<th><s:text name="lbl.entryDate" /></th>
		<th>&nbsp;</th>
	</tr>

	<%-- Data --%>
	<s:iterator value="students" status="nrStudent">
		<s:form theme="simple">
			<s:hidden name="selectedSubjectId" />
			<tr
				<s:if test="#nrStudent.odd == true">
				class="highlighted"
			</s:if>>
				<%-- Student name --%>
				<td><s:hidden value="students[#nrStudent.index]" /> <s:property
						value="lastName" />, <s:property value="firstName" /> <s:hidden
						name="id" /></td>

				<%-- Results --%>
				<%-- 0 tries --%>
				<s:if test="numberTries[#nrStudent.index]==0">
					<td>-</td>
					<td>-</td>
					<td>-</td>
					<td>-</td>
					<td>-</td>
					<td>-</td>
					<td>-</td>
					<td><s:submit theme="simple" key="button.edit"
							action="EditExam" /></td>
				</s:if>

				<%-- 1 try --%>
				<s:elseif test="numberTries[#nrStudent.index]==1">
					<td><s:property value="results[#nrStudent.index][0].grade" /></td>
					<td>-</td>
					<td>-</td>
					<td><s:property
							value="results[#nrStudent.index][0].examination.date" /></td>
					<td><s:property
							value="results[#nrStudent.index][0].examination.lecturer" /></td>
					<td><s:property value="results[#nrStudent.index][0].typist" /></td>
					<td><s:property value="results[#nrStudent.index][0].entryDate" /></td>
					<td><s:submit theme="simple" key="button.edit"
							action="EditExam" /></td>
				</s:elseif>

				<%-- 2 tries --%>
				<s:elseif test="numberTries[#nrStudent.index]==2">
					<td><s:property value="results[#nrStudent.index][0].grade" /></td>
					<td><s:property value="results[#nrStudent.index][1].grade" /></td>
					<td>-</td>
					<td><s:property
							value="results[#nrStudent.index][1].examination.date" /></td>
					<td><s:property
							value="results[#nrStudent.index][1].examination.lecturer" /></td>
					<td><s:property value="results[#nrStudent.index][1].typist" /></td>
					<td><s:property value="results[#nrStudent.index][1].entryDate" /></td>
					<td><s:submit theme="simple" key="button.edit"
							action="EditExam" /></td>
				</s:elseif>

				<%-- 3 tries --%>
				<s:elseif test="numberTries[#nrStudent.index]==3">
					<td><s:property value="results[#nrStudent.index][0].grade" /></td>
					<td><s:property value="results[#nrStudent.index][1].grade" /></td>
					<td><s:property value="results[#nrStudent.index][2].grade" /></td>
					<td><s:property
							value="results[#nrStudent.index][2].examination.date" /></td>
					<td><s:property
							value="results[#nrStudent.index][2].examination.lecturer" /></td>
					<td><s:property value="results[#nrStudent.index][2].typist" /></td>
					<td><s:property value="results[#nrStudent.index][2].entryDate" /></td>
					<td><s:submit theme="simple" key="button.edit"
							action="EditExam" /></td>
				</s:elseif>
			</tr>
		</s:form>
	</s:iterator>
</table>

